<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" name="number" value="33" />
    <script>
      /* 
    NaN
    
    */

      console.log(Number("hahaha"));
      console.log(Number.isNaN("xixixi"));

      let hd = "33";
      console.log(Number(hd));

      let input = document.querySelector("[name = number]").value;
      console.log(input);
      console.log(typeof input);

      /* 表单如果不设置 type = number，输入的的都是字符串 */

      console.log(parseInt(input));
      console.log(typeof parseInt(input));

      console.log(typeof Number(input));

      //保存小数

      let d = 100.116;
      // 四舍五入
      console.log(d.toFixed(2));
    </script>
  </body>
</html>
